/**
 * Created by scutterry on 16/3/20.
 */
define([],
function(){
    var NUM_PAGE = 10;
    function f(){
        this.begin = 0;
        this.end = NUM_PAGE;
        this.isEnd = false;
    }

    f.prototype.reset = function(){
        this.begin = 0;
        this.end = NUM_PAGE;
        this.isEnd = false;
    };

    f.prototype.next = function(){
        if(!this.isEnd){
            this.begin = this.end;
            this.end += NUM_PAGE;
        }
    };

    f.prototype.prev = function(){
        if(this.begin > 0){
            this.end = this.begin;
            this.begin -= NUM_PAGE;
            this.begin = Math.max(0, this.begin);
        }
    };

    f.prototype.updateEndFlag = function(list){
        this.isEnd = !(list && list.length === NUM_PAGE);
    };

    return f;
});
